package com.bestcem.xm.deliver.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bestcem.xm.common.core.domain.web.ServiceResult;
import com.bestcem.xm.component.mybatis.service.IXmService;
import com.bestcem.xm.deliver.controller.param.EmailRecordsPageParam;
import com.bestcem.xm.deliver.controller.v2.param.EmailDeliversParam;
import com.bestcem.xm.deliver.controller.v2.param.MemberDeliverDataByEmail;
import com.bestcem.xm.deliver.controller.v2.vo.DeliverGroupListVo;
import com.bestcem.xm.deliver.entity.*;
import com.bestcem.xm.deliver.enums.DeliverTtypeEnum;

import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * @author been
 * @description 针对表【ds_deliver_emaildeliver】的数据库操作Service
 * @createDate 2022-11-07 13:49:46
 */
public interface DeliverEmailDeliverService extends IXmService<DeliverEmailDeliver> {
    List<DeliverGroupListVo> qdesDeliverGroup(String surveyId);

    ServiceResult<?> emailDeliverRecord(Page<DeliverEmailRecord> page, EmailRecordsPageParam param);

    Map<String, List<Integer>> getDeliverDataMember(Boolean urged, String surveyStatus, String deliverGroupId, String deliverId, List<String> member_ids);

    DeliverDeliver getDeliver(String deliverId);

    ServiceResult<?> urgeRecord(String deliverId, String memberId, String deliverGroupId);

    void triggerDeliverStatus(DeliverDeliver deliver, String action);

    ServiceResult<?> updateEmailDelivers(String id, JSONObject param);

    ServiceResult<Integer> dealRandomSampling(JSONObject randomSampling, int size);

    List<MemberDeliverDataByEmail> parseInputStream(String excelFilePath);

    String getQdesName(String projectId, String qStructId);

    String getSystemName(String orgId);

    ServiceResult<?> editEmailDelivers(String id, JSONObject param);

    void delDeliverFromGroup(String deliverId, String survey_id);

    void emailDeliverExport(JSONObject param, HttpServletResponse response, DeliverEmailDeliver emailDeliver, DeliverDeliver deliver);

    void getTitleHead(List<List<String>> headRowList, List<String> titelList);

    ServiceResult<?> emailDeliverAgain(String id, JSONObject param, DeliverEmailDeliver emailDeliver);

    JSONObject buildRecastParams(DeliverDeliver deliver, String recast_nums, DeliverDeliverGroup deliverDeliverGroup, DeliverEmailDeliver emailDeliver, DeliverSmsDeliver smsDeliver);

    DeliverDeliverGroup originGetDeliverGroup(String deliverGid);

    DeliverRecast getOneRecast(String deliverId);

    ServiceResult<?> emailDeliverUrge(String id, JSONObject param);

    List<String> checkMemberDeliverStatus4Urge(List<String> member_ids, String deliverGroupId, String deliverId, DeliverTtypeEnum deliverTtypeSms);

    List<String> filterDeliverUrgeMembers(List<String> member_ids, boolean b, boolean b1);

    void triggerDeliverCheckStatus(DeliverDeliver deliverRes, String action);

    void createOrUpdateRecast(String orgId, String deliverId, String new_deliver_id);

    boolean checkMemberDeliverUrgeStatus(String member_id, String deliverGroupId, String deliverId);

    ServiceResult<?> emailDelivers(EmailDeliversParam param);

    String createEmailDeliver(EmailDeliversParam param);

    DeliverDeliver createDeliver(String orgId, String deliverId, String deliverName, LocalDateTime deliverTime, Integer ttype, Integer channel, int awardUseType, String awardId);

    void deliverCreateSurveydeliver(String orgId, String surveyId, String deliverId);

    String createDeliverGroup(String orgId, String surveyId, List<String> deliverList);

    void addDeliverToGroup(String deliverId, String surveyId, String deliverGid);
}
